<include file="Public:header" />
<div class="container main"> <include file="Public:left" />
    <div class="w790">
        <div class="h">
            <a href="{:U('index',['id'=>'1'])}" class="btn btn-info">修改登录密码</a>
            <a href="{:U('index',['id'=>'2'])}" class="btn btn-info">修改提现密码</a>
            <a href="{:U('index',['id'=>'3'])}" class="btn btn-info">绑定手机号码</a>
            <div style="clear:both;"></div>
        </div>
        <div class="table_">
            <?php if(!isset($_GET['id'])) $_GET['id']=1;?>
            <?php if($_GET['id']==1){ ?>
            <!--修改登录密码-->
            <form class="checkoutform2 form-horizontal" action="{:U('pwdchange')}" method="post">
                <input type="hidden" name="id" value="{$info.id}" />
                <div class="container">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">原密码</label>
                        <div class="col-sm-10">
                            <input name="oldpassword" class="form-control" id="oldpassword" type="text" value="" placeholder="请输入原密码"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">新密码</label>
                        <div class="col-sm-10">
                            <input name="newpassword" class="form-control" min="6" maxlength="12" id="newpassword" type="password" placeholder="新密码"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">确认密码</label>
                        <div class="col-sm-10">
                            <input name="renewpassword" class="form-control" min="6" maxlength="12" id="renewpassword" type="password" placeholder="确认密码"/>
                        </div>
                    </div>
                    <div class="pages">
                        <button type="submit" class="btn btn-success">保存</button>
                    </div>
                </div>
            </form>
            <?php }elseif($_GET['id']==2){ ?>
            <eq name="info['VerifyPhone']" value="1">
                <form class="form-horizontal" id="verifymobile2" action="{:U('setpwdverifymobile')}" method="post" role="form">
                    <div class="form-group">
                        <label for="inputPassword1" class="col-lg-3 col-sm-3 control-label"></label>
                        <div class="col-lg-6">
                            <p><i style="font-size:24px;" class="fa fa-mobile"></i>&nbsp;&nbsp;<span style="color:#ccc; font-size:18px;">{:hidtel($info['tel'])}</span></p>
                        </div>
                    </div><div class="form-group">
                    <label for="inputPassword1" class="col-lg-3 col-sm-3 control-label">验证码</label>
                    <div class="col-lg-6">
                        <input style="display:inline; width:auto;" type="text" class="form-control" name="verifytelpwd" id="verifytelpwd" placeholder="验证码">
                        <button style="vertical-align:top;" type="button" id="sendsms2" class="btn btn-info">获取验证码</button>
                    </div>
                </div>
                    <div class="form-group">
                        <label for="inputPassword1" class="col-lg-3 col-sm-3 control-label">设置密码</label>
                        <div class="col-lg-6">
                            <input type="password" class="form-control" name="pwd" id="newpassword2" placeholder="密码">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputPassword1" class="col-lg-3 col-sm-3 control-label">确认密码</label>
                        <div class="col-lg-6">
                            <input type="password" class="form-control" name="repwd" id="repwd" placeholder="确认密码">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-offset-3 col-lg-6">
                            <button type="submit" class="btn btn-info">确认修改</button>
                        </div>
                    </div>
                    <else/>
                    <div class="form-group">
                        <div class="col-lg-offset-3 col-lg-6"> 请先绑定手机号，再设置提现密码。 </div>
                    </div>
            </eq>
            <?php }elseif($_GET['id']==3){ ?>
            <eq name="info['VerifyPhone']" value="0"><br>
                <br>
                <br>
                <form class="form-horizontal" id="mobilebind" action="{:U('mobilebind')}" method="post" role="form">
                    <div class="form-group">
                        <label for="inputPassword1" class="col-lg-3 col-sm-3 control-label">手机号码</label>
                        <div class="col-lg-6">
                            <input style="display:inline; width:auto;" type="text" class="form-control" name="verifytel" id="verifytel" placeholder="填写手机号码">
                            <button style="vertical-align:top;" type="button" id="sendsms1" class="btn btn-info">获取验证码</button>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputPassword1" class="col-lg-3 col-sm-3 control-label">验证码</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control" name="verify" placeholder="验证码">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-offset-3 col-lg-6">
                            <button type="submit" class="btn btn-info">绑定</button>
                        </div>
                    </div>
                </form>
                <br>
                <br>
                <br>
                <else/>
                <br>
                <br>
                <br>
                <div class="form-group">
                    <div class="col-lg-offset-3 col-lg-6">
                        <p>已经绑定</p>
                        <p><i style="font-size:24px;" class="fa fa-mobile"></i>&nbsp;&nbsp;<span style="color:#ccc; font-size:18px;">{:hidtel($info['tel'])}</span>&nbsp;&nbsp;&nbsp;<a href="##" data-toggle="modal" data-target="#myModal" style="color:#f00"> 解绑</a></p>
                        <p>您已经绑定了手机号码，如果您想重新绑定，请点击解绑。</p>
                    </div>
                </div>
                <br>
                <br>
                <br>
                <br>
                <br>
            </eq>
            <?php } ?>
        </div>
    </div>
    <div class="clear"></div>
</div>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">手机号解绑</h4>
            </div>
            <div class="modal-body">
                <form action="{:U('mobileunbind')}" id="mobileunbind" method="post" role="form">
                    <div style="padding:30px 50px;">
                        <div  class="form-inline">
                            <div class="form-group">
                                <label class="sr-only" for="exampleInputPassword2">验证码</label>
                                <input type="text" name="verify" class="form-control" id="exampleInputPassword2" placeholder="验证码">
                            </div>
                            <button type="button" id="sendsms" class="btn btn-primary">获取验证码</button>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" onClick="$('#mobileunbind').submit();" class="btn btn-primary">解绑</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal -->
</div>
<include file="Public:footer" />
<script>
    var countdown = 5*60;
    function settime(val) {
        if (countdown == 0) {
            val.removeAttribute("disabled");
            val.innerHTML="获取验证码";
            countdown = 5*60;
        } else {
            val.setAttribute("disabled", true);
            val.innerHTML="重新发送(" + countdown + ")";
            countdown--;
        }
        setTimeout(function() {
            settime(val)
        },1000)
    }

    $('#sendsms').click(function(e) {

        $.post('{:U('sendmsm')}', {
        }, function(d){
            alert(d.info);
            if(d.status == 1){
                settime(document.getElementById('sendsms'));
            }

        },'json');
    });

    $('#sendsms1').click(function(e) {

        $.post('{:U('sendmsm')}', {
            tel: $('#verifytel').val()
        }, function(d){
            alert(d.info);
            if(d.status == 1){
                settime(document.getElementById('sendsms1'));
            }

        },'json');
    });
    $('#sendsms2').click(function(e) {

        $.post('{:U('sendmsm')}', {
        }, function(d){
            alert(d.info);
            if(d.status == 1){
                settime(document.getElementById('sendsms2'));
            }

        },'json');
    });

</script>